/*
 * 创建用户：mleo
 * 项目名称：demo
 * 模块名称：demo
 * 文件名称：TrainTicket
 * 修改时间：2017/11/14 13:55:27
 * Copyright (c) 2017.
 */

package com.ichochy.thread;

import java.util.concurrent.TimeUnit;

public class TrainTicket implements Runnable{
    private static volatile Integer ticetTotal = 10;

    @Override
    public void run() {
        System.out.println("开始……");
        while (ticetTotal>0){
            try {
                TimeUnit.MILLISECONDS.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
                System.out.println("窗口："+Thread.currentThread().getName()+" 剩余票数："+(ticetTotal--));
        }
    }

}
